public class Main
{
    public static void main(String[] args)
    {
//        System.out.println("Hello world!");
        int[] arr={1,3,4,6,7,8,10,11,13,15};
        int target=3;
        System.out.println(Search(arr,target,0,arr.length-1));
    }

    private static int Search(int[]arr,int target,int left,int right)
    {
        if(right<left)
        {
            return -1;
        }
        int mid=(left+right)/2;

        if(arr[mid]==target)
        {
            return mid;
        }
        else if(arr[mid]<target)
        {
            return Search(arr,target,left+1,right);
        }
        else{
             return Search(arr,target,left,right-1);
        }
    }
}